using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using FoundationLib.Ifc.Domain;


namespace FoundationLib.Ifc.Domain 
{
	/// <summary>
	/// Interface for aggregates which provide facilities for event sourcing
	/// </summary>
	public interface IEventSourcedAggregate : IAggregate   
	{
		/// <summary>
		/// Gets the set of pending versioned events for this aggregate
		/// </summary>
		IPendingChanges Changes
		{
			get;
		}

		/// <summary>
		/// Gets the current version of the aggregate
		/// </summary>
		int Version
		{
			get;
		}

		/// <summary>
		/// Reconstructs the state of the entity from the given event history
		/// </summary>
		/// <param name="eventHistory">The event history</param>
		void LoadFromHistory(IEnumerable<IVersionedEvent> eventHistory);
	}

}